package service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import dao.TouristDao;
import dao.impl.TouristDaoImpl;
import entity.Tourist;
import service.TouristService;

import java.util.List;

public class TouristServiceImpl implements TouristService {

    private TouristDao touristDao = new TouristDaoImpl();

    @Override
    public int insert(Tourist tourist) {
        return touristDao.insert(tourist);
    }

    @Override
    public int delete(int id) {
        return touristDao.delete(id);
    }

    @Override
    public int update(Tourist tourist) {
        return touristDao.update(tourist);
    }

    @Override
    public Tourist getOne(int id) {
        return touristDao.getOne(id);
    }

    @Override
    public List<Tourist> getList(Tourist tourist) {
        return touristDao.getList(tourist);
    }

    @Override
    public PageInfo<Tourist> getPageList(Tourist tourist) {
        PageHelper.startPage(tourist.getPageNum(), tourist.getPageSize());
        return new PageInfo<Tourist>(touristDao.getList(tourist));
    }

}
